﻿using System;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.UI;

public class ShowChangelogOnStart : MonoBehaviour
{
    public TextAsset changelogAsset;
    [SerializeField]
    private GameObject m_changelog;
    [SerializeField]
    private Text m_changelogText;

    private void Start()
    {
        char[] trimChars = new char[] { 'v' };
        char[] chArray2 = new char[] { ':' };
        string str = Regex.Match(this.changelogAsset.text, "v.*:").Value.TrimStart(trimChars).TrimEnd(chArray2);
        Debug.Log("Current Version: " + str);
        this.m_changelog.SetActive(PlayerPrefs.GetString("ShowChangelogOnStart.lastVersion") != str);
        this.m_changelogText.text = this.changelogAsset.text;
        PlayerPrefs.SetString("ShowChangelogOnStart.lastVersion", str);
    }
}

